package com.hxzy.controller.front;

import com.hxzy.common.controller.BaseController;
import com.hxzy.common.vo.R;
import com.hxzy.entity.MerchandiseClass;
import com.hxzy.service.MerchandiseClassService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "前端商品分类API")
@RestController
@RequestMapping(value = "/front/category")
public class FrontCategoryController extends BaseController {

    @Autowired
    private MerchandiseClassService merchandiseClassService;

    @ApiOperation(value = "当前商家的分类列表")
    @GetMapping(value = "/list/{merchantId}")
    public R findByMerchantId(@PathVariable(value = "merchantId") Long merchantId){
        List<MerchandiseClass> arr=this.merchandiseClassService.findByMerchandiseId(merchantId);
        return R.okHasData(arr);
    }
}
